﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace WEALTH.Manager.Customer
{
    public partial class IdxMarqueeManage : BasePage
    {
        ExcuteDao dao = new ExcuteDao();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                GetInfo();
            }
        }

        private void GetInfo()
        {
            DataTable dt1 = dao.GET_IdxMarquee("首页滚动文字");

            if (dt1 != null && dt1.Rows.Count > 0)
            {
                topTextID.Value = dt1.Rows[0]["id"].ToString();
                topText.Text = dt1.Rows[0]["textValue"].ToString();
                rblTopText_IsUse.SelectedValue = "1";
                rblTopText_IsUse.SelectedValue = dt1.Rows[0]["enableFlag"].ToString();

            }
        }

        protected void btnInsert_Click(object sender, EventArgs e)
        {
            int id = 0;
            if (topTextID.Value != "" && topTextID.Value != null)
            {
                id = Convert.ToInt32(topTextID.Value);
            }
            int rtn = dao.Update_IdxMarquee(id, topText.Text, rblTopText_IsUse.SelectedValue, "首页滚动文字");
            if (rtn > 0)
            {
                ShowMsg("修改成功", 0);
                GetInfo();
            }
            else
            {
                ShowMsg("修改失败", 1);
            }
        }
    }
}